Namespace Datos
    Public Class definicionBaseAttribute
        Inherits System.Attribute
        Dim _tipo As enTipoCampoBase
        Dim _fielSoloLectura As String
        Dim _nombreCampoBase As String
        Dim _nombreSeq As String
        Public Sub New(ByVal nombreCampoBase As String, Optional ByVal tipo As enTipoCampoBase = enTipoCampoBase.camposNormal, Optional ByVal fieldSoloLectura As String = Nothing, Optional ByVal nombreSeq As String = Nothing)
            _tipo = tipo
            _fielSoloLectura = fieldSoloLectura
            _nombreCampoBase = nombreCampoBase
            _nombreSeq = nombreSeq
        End Sub
        Public ReadOnly Property nombreCampoBase() As String
            Get
                Return _nombreCampoBase
            End Get
        End Property
        Public ReadOnly Property fieldSoloLectura() As String
            Get
                Return _fielSoloLectura
            End Get
        End Property
        Public ReadOnly Property NombreSeq() As String
            Get
                Return _nombreSeq
            End Get
        End Property
        Public ReadOnly Property Tipo() As enTipoCampoBase
            Get
                Return _tipo
            End Get
        End Property
    End Class
    Public Class camposAtributos
        Dim _propiedad As System.Reflection.PropertyInfo
        Dim _atributo As definicionBaseAttribute
        Dim _fieldSoloLectura As System.Reflection.FieldInfo
        Public Sub New(ByVal propiedad As System.Reflection.PropertyInfo, ByVal atributo As definicionBaseAttribute, Optional ByVal fielSoloLectura As System.Reflection.FieldInfo = Nothing)
            _propiedad = propiedad
            _atributo = atributo
            _fieldSoloLectura = fielSoloLectura
        End Sub
        ReadOnly Property Atributo() As definicionBaseAttribute
            Get
                Return _atributo
            End Get
        End Property
        ReadOnly Property Propiedad() As System.Reflection.PropertyInfo
            Get
                Return _propiedad
            End Get
        End Property
        Public Function getData(ByVal objeto As Object) As Object
            Return Propiedad.GetValue(objeto, Nothing)
        End Function
        Public Sub setData(ByVal objeto As Object, ByVal data As Object)
            If data Is System.DBNull.Value = False Then
                If Propiedad.CanWrite And Atributo.fieldSoloLectura Is Nothing Then
                    Propiedad.SetValue(objeto, data, Nothing)
                Else
                    _fieldSoloLectura.SetValue(objeto, data)
                End If
            End If
        End Sub

    End Class

    Public Enum enTipoCampoBase
        parteLlavePrimaria = 1
        llaveForanea = 2
        camposNormal = 3
        campoTabla = 4
    End Enum
End Namespace

